package com.jt.www.enums;

import com.jt.www.exception.BizException;


public enum CorrectTypeEnum implements BaseEnum {
    NORMAL(1, "一般性批改", "00", "0"),
    ALETER(2, "保费冲正", "01", "1"),
    DELET(3, "删除", "01", "2");

    private int code;
    private String msg;
    private String insOrderCode;
    private String endorsementCode;

    CorrectTypeEnum(int code, String name, String insOrderCode, String endorsementCode) {
        this.code = code;
        this.msg = name;
        this.insOrderCode = insOrderCode;
        this.endorsementCode = endorsementCode;
    }

    public static String getInsOrderCodeByCode(int v) {
        for (CorrectTypeEnum e : CorrectTypeEnum.values()) {
            if (Integer.parseInt(e.getCode().toString()) == v) {
                return e.getInsOrderCode();
            }
        }
        throw new BizException("找不到投保中心对应的项目核算类型");
    }


    public static String getEndorsementCodeByCode(int v) {
        for (CorrectTypeEnum e : CorrectTypeEnum.values()) {
            if (Integer.parseInt(e.getCode().toString()) == v) {
                return e.getEndorsementCode();
            }
        }
        throw new BizException("找不到投保中心对应的项目核算类型");
    }

    @Override
    public Object getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public String getInsOrderCode() {
        return insOrderCode;
    }

    public String getEndorsementCode() {
        return endorsementCode;
    }
}
